<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/xhtml;charset=UTF-8"/>
<meta http-equiv="X-UA-Compatible" content="IE=9"/>
<meta name="generator" content="Doxygen 1.8.6"/>
<title>3dchess: AbstractPlayer Class Reference</title>
<link href="tabs.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="jquery.js"></script>
<script type="text/javascript" src="dynsections.js"></script>
<link href="search/search.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="search/search.js"></script>
<script type="text/javascript">
  $(document).ready(function() { searchBox.OnSelectItem(0); });
</script>
<link href="doxygen.css" rel="stylesheet" type="text/css" />
</head>
<body>
<div id="top"><!-- do not remove this div, it is closed by doxygen! -->
<div id="titlearea">
<table cellspacing="0" cellpadding="0">
 <tbody>
 <tr style="height: 56px;">
  <td style="padding-left: 0.5em;">
   <div id="projectname">3dchess
   </div>
   <div id="projectbrief">Basic chess application with OpenGL graphics and AI</div>
  </td>
 </tr>
 </tbody>
</table>
</div>
<!-- end header part -->
<!-- Generated by Doxygen 1.8.6 -->
<script type="text/javascript">
var searchBox = new SearchBox("searchBox", "search",false,'Search');
</script>
  <div id="navrow1" class="tabs">
    <ul class="tablist">
      <li><a href="index.html"><span>Main&#160;Page</span></a></li>
      <li><a href="namespaces.html"><span>Namespaces</span></a></li>
      <li class="current"><a href="annotated.html"><span>Classes</span></a></li>
      <li><a href="files.html"><span>Files</span></a></li>
      <li>
        <div id="MSearchBox" class="MSearchBoxInactive">
        <span class="left">
          <img id="MSearchSelect" src="search/mag_sel.png"
               onmouseover="return searchBox.OnSearchSelectShow()"
               onmouseout="return searchBox.OnSearchSelectHide()"
               alt=""/>
          <input type="text" id="MSearchField" value="Search" accesskey="S"
               onfocus="searchBox.OnSearchFieldFocus(true)" 
               onblur="searchBox.OnSearchFieldFocus(false)" 
               onkeyup="searchBox.OnSearchFieldChange(event)"/>
          </span><span class="right">
            <a id="MSearchClose" href="javascript:searchBox.CloseResultsWindow()"><img id="MSearchCloseImg" border="0" src="search/close.png" alt=""/></a>
          </span>
        </div>
      </li>
    </ul>
  </div>
  <div id="navrow2" class="tabs2">
    <ul class="tablist">
      <li><a href="annotated.html"><span>Class&#160;List</span></a></li>
      <li><a href="classes.html"><span>Class&#160;Index</span></a></li>
      <li><a href="hierarchy.html"><span>Class&#160;Hierarchy</span></a></li>
      <li><a href="functions.html"><span>Class&#160;Members</span></a></li>
    </ul>
  </div>
<!-- window showing the filter options -->
<div id="MSearchSelectWindow"
     onmouseover="return searchBox.OnSearchSelectShow()"
     onmouseout="return searchBox.OnSearchSelectHide()"
     onkeydown="return searchBox.OnSearchSelectKey(event)">
<a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(0)"><span class="SelectionMark">&#160;</span>All</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(1)"><span class="SelectionMark">&#160;</span>Classes</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(2)"><span class="SelectionMark">&#160;</span>Namespaces</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(3)"><span class="SelectionMark">&#160;</span>Functions</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(4)"><span class="SelectionMark">&#160;</span>Variables</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(5)"><span class="SelectionMark">&#160;</span>Typedefs</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(6)"><span class="SelectionMark">&#160;</span>Enumerations</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(7)"><span class="SelectionMark">&#160;</span>Enumerator</a></div>

<!-- iframe showing the search results (closed by default) -->
<div id="MSearchResultsWindow">
<iframe src="javascript:void(0)" frameborder="0" 
        name="MSearchResults" id="MSearchResults">
</iframe>
</div>

</div><!-- top -->
<div class="header">
  <div class="summary">
<a href="#pub-methods">Public Member Functions</a> &#124;
<a href="class_abstract_player-members.html">List of all members</a>  </div>
  <div class="headertitle">
<div class="title">AbstractPlayer Class Reference<span class="mlabels"><span class="mlabel">abstract</span></span></div>  </div>
</div><!--header-->
<div class="contents">

<p>Class a player has to implement to interact with the <a class="el" href="class_game_logic.html" title="GameLogic implementation for a game of chess with observers. ">GameLogic</a>.  
 <a href="class_abstract_player.html#details">More...</a></p>

<p><code>#include &lt;<a class="el" href="_abstract_player_8h_source.html">AbstractPlayer.h</a>&gt;</code></p>
<div class="dynheader">
Inheritance diagram for AbstractPlayer:</div>
<div class="dyncontent">
 <div class="center">
  <img src="class_abstract_player.png" usemap="#AbstractPlayer_map" alt=""/>
  <map id="AbstractPlayer_map" name="AbstractPlayer_map">
<area href="class_abstract_game_observer.html" title="Allows to observe relevant GameEvents inside the GameLogic. " alt="AbstractGameObserver" shape="rect" coords="310,0,455,24"/>
<area href="class_a_i_player.html" title="Artificial intelligence player implementation. " alt="AIPlayer" shape="rect" coords="0,112,145,136"/>
<area href="class_console_player.html" title="Class which takes human player interaction from a console. " alt="ConsolePlayer" shape="rect" coords="155,112,300,136"/>
<area href="class_dummy_player.html" title="Player implementation which takes random turns after random amounts of time. " alt="DummyPlayer" shape="rect" coords="310,112,455,136"/>
<area href="class_g_u_i_player.html" title="Player implementation for a real/human user. " alt="GUIPlayer" shape="rect" coords="465,112,610,136"/>
<area href="class_player_dispatcher_proxy.html" title="Proxy for transporting AbstractGamePlayer events between threads. " alt="PlayerDispatcherProxy" shape="rect" coords="620,112,765,136"/>
</map>
 </div></div>
<table class="memberdecls">
<tr class="heading"><td colspan="2"><h2 class="groupheader"><a name="pub-methods"></a>
Public Member Functions</h2></td></tr>
<tr class="memitem:a330465dd29cbd703563c89cdb48e895c"><td class="memItemLeft" align="right" valign="top">virtual void&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="class_abstract_player.html#a330465dd29cbd703563c89cdb48e895c">onSetColor</a> (PlayerColor color)=0</td></tr>
<tr class="memdesc:a330465dd29cbd703563c89cdb48e895c"><td class="mdescLeft">&#160;</td><td class="mdescRight">Notifies that player what color he will be playing.  <a href="#a330465dd29cbd703563c89cdb48e895c">More...</a><br/></td></tr>
<tr class="separator:a330465dd29cbd703563c89cdb48e895c"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:a4954d2cc3b71d352188c863bb3d1e176"><td class="memItemLeft" align="right" valign="top">virtual std::future&lt; <a class="el" href="class_turn.html">Turn</a> &gt;&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="class_abstract_player.html#a4954d2cc3b71d352188c863bb3d1e176">doMakeTurn</a> (<a class="el" href="class_game_state.html">GameState</a> state)=0</td></tr>
<tr class="memdesc:a4954d2cc3b71d352188c863bb3d1e176"><td class="mdescLeft">&#160;</td><td class="mdescRight">Asks the player to make his turn.  <a href="#a4954d2cc3b71d352188c863bb3d1e176">More...</a><br/></td></tr>
<tr class="separator:a4954d2cc3b71d352188c863bb3d1e176"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:a6f129cba16e36619b7672e633712b89b"><td class="memItemLeft" align="right" valign="top">virtual void&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="class_abstract_player.html#a6f129cba16e36619b7672e633712b89b">doAbortTurn</a> ()=0</td></tr>
<tr class="memdesc:a6f129cba16e36619b7672e633712b89b"><td class="mdescLeft">&#160;</td><td class="mdescRight">Asks the player to abort a turn asked for with doMakeTurn.  <a href="#a6f129cba16e36619b7672e633712b89b">More...</a><br/></td></tr>
<tr class="separator:a6f129cba16e36619b7672e633712b89b"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="inherit_header pub_methods_class_abstract_game_observer"><td colspan="2" onclick="javascript:toggleInherit('pub_methods_class_abstract_game_observer')"><img src="closed.png" alt="-"/>&#160;Public Member Functions inherited from <a class="el" href="class_abstract_game_observer.html">AbstractGameObserver</a></td></tr>
<tr class="memitem:a34fd2b4c53d3beb7c6bb3edebe185150 inherit pub_methods_class_abstract_game_observer"><td class="memItemLeft" align="right" valign="top">virtual void&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="class_abstract_game_observer.html#a34fd2b4c53d3beb7c6bb3edebe185150">onGameStart</a> (<a class="el" href="class_game_state.html">GameState</a> state, <a class="el" href="class_game_configuration.html">GameConfiguration</a> config)</td></tr>
<tr class="memdesc:a34fd2b4c53d3beb7c6bb3edebe185150 inherit pub_methods_class_abstract_game_observer"><td class="mdescLeft">&#160;</td><td class="mdescRight">Called when the game starts.  <a href="#a34fd2b4c53d3beb7c6bb3edebe185150">More...</a><br/></td></tr>
<tr class="separator:a34fd2b4c53d3beb7c6bb3edebe185150 inherit pub_methods_class_abstract_game_observer"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:a64dd519a6445dc104e7387b394c0286e inherit pub_methods_class_abstract_game_observer"><td class="memItemLeft" align="right" valign="top">virtual void&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="class_abstract_game_observer.html#a64dd519a6445dc104e7387b394c0286e">onTurnStart</a> (PlayerColor who)</td></tr>
<tr class="memdesc:a64dd519a6445dc104e7387b394c0286e inherit pub_methods_class_abstract_game_observer"><td class="mdescLeft">&#160;</td><td class="mdescRight">Called if a player is asked to perform a turn.  <a href="#a64dd519a6445dc104e7387b394c0286e">More...</a><br/></td></tr>
<tr class="separator:a64dd519a6445dc104e7387b394c0286e inherit pub_methods_class_abstract_game_observer"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:afc2f078de79701a8cd77ce733459cf6c inherit pub_methods_class_abstract_game_observer"><td class="memItemLeft" align="right" valign="top">virtual void&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="class_abstract_game_observer.html#afc2f078de79701a8cd77ce733459cf6c">onTurnEnd</a> (PlayerColor who, <a class="el" href="class_turn.html">Turn</a> turn, <a class="el" href="class_game_state.html">GameState</a> newState)</td></tr>
<tr class="memdesc:afc2f078de79701a8cd77ce733459cf6c inherit pub_methods_class_abstract_game_observer"><td class="mdescLeft">&#160;</td><td class="mdescRight">Called if a player ended its turn.  <a href="#afc2f078de79701a8cd77ce733459cf6c">More...</a><br/></td></tr>
<tr class="separator:afc2f078de79701a8cd77ce733459cf6c inherit pub_methods_class_abstract_game_observer"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:a74ba4cdca13bb0227722beeeebfd6e12 inherit pub_methods_class_abstract_game_observer"><td class="memItemLeft" align="right" valign="top">virtual void&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="class_abstract_game_observer.html#a74ba4cdca13bb0227722beeeebfd6e12">onTurnTimeout</a> (PlayerColor who, std::chrono::seconds timeout)</td></tr>
<tr class="memdesc:a74ba4cdca13bb0227722beeeebfd6e12 inherit pub_methods_class_abstract_game_observer"><td class="mdescLeft">&#160;</td><td class="mdescRight">Called if a players turn is aborted due to timeout.  <a href="#a74ba4cdca13bb0227722beeeebfd6e12">More...</a><br/></td></tr>
<tr class="separator:a74ba4cdca13bb0227722beeeebfd6e12 inherit pub_methods_class_abstract_game_observer"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:ac24e139ff56d25fb7e77afdfb35fab5c inherit pub_methods_class_abstract_game_observer"><td class="memItemLeft" align="right" valign="top">virtual void&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="class_abstract_game_observer.html#ac24e139ff56d25fb7e77afdfb35fab5c">onGameOver</a> (<a class="el" href="class_game_state.html">GameState</a> state, PlayerColor winner)</td></tr>
<tr class="memdesc:ac24e139ff56d25fb7e77afdfb35fab5c inherit pub_methods_class_abstract_game_observer"><td class="mdescLeft">&#160;</td><td class="mdescRight">Called when a game started with onGameStart is over.  <a href="#ac24e139ff56d25fb7e77afdfb35fab5c">More...</a><br/></td></tr>
<tr class="separator:ac24e139ff56d25fb7e77afdfb35fab5c inherit pub_methods_class_abstract_game_observer"><td class="memSeparator" colspan="2">&#160;</td></tr>
</table>
<a name="details" id="details"></a><h2 class="groupheader">Detailed Description</h2>
<div class="textblock"><p>Class a player has to implement to interact with the <a class="el" href="class_game_logic.html" title="GameLogic implementation for a game of chess with observers. ">GameLogic</a>. </p>
<p>Every player is also a <a class="el" href="class_abstract_game_observer.html" title="Allows to observe relevant GameEvents inside the GameLogic. ">AbstractGameObserver</a> which is notified of relevant game events. You do not need to register the player as an observer for this to happen.</p>
<dl class="section note"><dt>Note</dt><dd>A Observer is only required to stay in a valid state for one game. It is free to halt its operations after the end of the game.</dd></dl>
<dl class="section warning"><dt>Warning</dt><dd>None of the functions in the class must block. </dd></dl>
</div><h2 class="groupheader">Member Function Documentation</h2>
<a class="anchor" id="a6f129cba16e36619b7672e633712b89b"></a>
<div class="memitem">
<div class="memproto">
<table class="mlabels">
  <tr>
  <td class="mlabels-left">
      <table class="memname">
        <tr>
          <td class="memname">virtual void AbstractPlayer::doAbortTurn </td>
          <td>(</td>
          <td class="paramname"></td><td>)</td>
          <td></td>
        </tr>
      </table>
  </td>
  <td class="mlabels-right">
<span class="mlabels"><span class="mlabel">pure virtual</span></span>  </td>
  </tr>
</table>
</div><div class="memdoc">

<p>Asks the player to abort a turn asked for with doMakeTurn. </p>
<p>When this is called the <a class="el" href="class_game_logic.html" title="GameLogic implementation for a game of chess with observers. ">GameLogic</a> will no longer react to the completion of the future for that turn. A use of this function is the abortion of a turn due to timeout. </p>

<p>Implemented in <a class="el" href="class_g_u_i_player.html#ad8a856e88d487c045d3cc4e754ca71fc">GUIPlayer</a>, <a class="el" href="class_player_dispatcher_proxy.html#a83fe09c22c7baba67628965bcef8d3a0">PlayerDispatcherProxy</a>, <a class="el" href="class_a_i_player.html#a9f7ebdaa567caa1fc07bbe8c700546a2">AIPlayer</a>, <a class="el" href="class_dummy_player.html#a8d9fdcb5c0172edf701da35dae556d43">DummyPlayer</a>, and <a class="el" href="class_console_player.html#a9129b83d6fdef0083fca3c96f2fecae1">ConsolePlayer</a>.</p>

</div>
</div>
<a class="anchor" id="a4954d2cc3b71d352188c863bb3d1e176"></a>
<div class="memitem">
<div class="memproto">
<table class="mlabels">
  <tr>
  <td class="mlabels-left">
      <table class="memname">
        <tr>
          <td class="memname">virtual std::future&lt;<a class="el" href="class_turn.html">Turn</a>&gt; AbstractPlayer::doMakeTurn </td>
          <td>(</td>
          <td class="paramtype"><a class="el" href="class_game_state.html">GameState</a>&#160;</td>
          <td class="paramname"><em>state</em></td><td>)</td>
          <td></td>
        </tr>
      </table>
  </td>
  <td class="mlabels-right">
<span class="mlabels"><span class="mlabel">pure virtual</span></span>  </td>
  </tr>
</table>
</div><div class="memdoc">

<p>Asks the player to make his turn. </p>
<dl class="section warning"><dt>Warning</dt><dd>This function must not block. It is to return immediatly. The players turn is to be set on the returned future. </dd></dl>
<dl class="section note"><dt>Note</dt><dd>The game logic can abort its request for a player to make his turn using the doAbortTurn function at any time. </dd></dl>
<dl class="params"><dt>Parameters</dt><dd>
  <table class="params">
    <tr><td class="paramname">state</td><td>Current state of the game. </td></tr>
  </table>
  </dd>
</dl>
<dl class="section return"><dt>Returns</dt><dd>A future to the turn to make. </dd></dl>

<p>Implemented in <a class="el" href="class_g_u_i_player.html#a9c69b6e933b665fff0d6154bb42c86d2">GUIPlayer</a>, <a class="el" href="class_dummy_player.html#a3ba604077071df9c8fbd481e339a77c3">DummyPlayer</a>, <a class="el" href="class_a_i_player.html#a2cc533895dc35ec8f9be82b82aa15418">AIPlayer</a>, <a class="el" href="class_player_dispatcher_proxy.html#a37c5c3e5d60e074a34570748b0b2a8b7">PlayerDispatcherProxy</a>, and <a class="el" href="class_console_player.html#aa464032047ef729c748fc9664739c74f">ConsolePlayer</a>.</p>

</div>
</div>
<a class="anchor" id="a330465dd29cbd703563c89cdb48e895c"></a>
<div class="memitem">
<div class="memproto">
<table class="mlabels">
  <tr>
  <td class="mlabels-left">
      <table class="memname">
        <tr>
          <td class="memname">virtual void AbstractPlayer::onSetColor </td>
          <td>(</td>
          <td class="paramtype">PlayerColor&#160;</td>
          <td class="paramname"><em>color</em></td><td>)</td>
          <td></td>
        </tr>
      </table>
  </td>
  <td class="mlabels-right">
<span class="mlabels"><span class="mlabel">pure virtual</span></span>  </td>
  </tr>
</table>
</div><div class="memdoc">

<p>Notifies that player what color he will be playing. </p>
<p>Called before onGameStart. </p>
<dl class="params"><dt>Parameters</dt><dd>
  <table class="params">
    <tr><td class="paramname">color</td><td>Color the player has. </td></tr>
  </table>
  </dd>
</dl>

<p>Implemented in <a class="el" href="class_g_u_i_player.html#a79cbf58be428867636859e13f88a97e5">GUIPlayer</a>, <a class="el" href="class_a_i_player.html#a8fbcee7ed68698889f139e378a9b0771">AIPlayer</a>, <a class="el" href="class_dummy_player.html#a9085902f8fbbf0b261b56cb36439875b">DummyPlayer</a>, <a class="el" href="class_player_dispatcher_proxy.html#a69147934e21adbbcf49ac0759a5bcd16">PlayerDispatcherProxy</a>, and <a class="el" href="class_console_player.html#a5acd643839da6578a9efb15b73ed4d07">ConsolePlayer</a>.</p>

</div>
</div>
<hr/>The documentation for this class was generated from the following file:<ul>
<li>S:/dev/3dchess/src/logic/interface/<a class="el" href="_abstract_player_8h_source.html">AbstractPlayer.h</a></li>
</ul>
</div><!-- contents -->
<!-- start footer part -->
<hr class="footer"/><address class="footer"><small>
Generated on Sun Mar 9 2014 23:12:56 for 3dchess by &#160;<a href="http://www.doxygen.org/index.html">
<img class="footer" src="doxygen.png" alt="doxygen"/>
</a> 1.8.6
</small></address>
</body>
</html>
